 
/***************** global variables ********************/

var LOADER = '<i class="icon-ajaxloader"></i>',
	LOADER01 = '<i class="icon-ajaxloader01"></i>',//organge loading
	userAgent = navigator.userAgent.toLowerCase(),
	browser={   
			version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],   
			safari: /webkit/.test( userAgent ),   
			opera: /opera/.test( userAgent ),   
			msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),   
			mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )   
	},
	REQUESTS = {
		UPLOAD: 'upload.php',
		ACTION: 'actions.php'
	},
	XHR_GlOBAL = null;
/*
 * Base scripts
 */
 
var Util = {
	loadScript: function(url, callback) {
	    var script = document.createElement("script");
	    script.type = "text/javascript";
	    // IE
	    if (script.readyState) {
	        script.onreadystatechange = function () {
	            if (script.readyState == "loaded" || script.readyState == "complete") {
	                script.onreadystatechange = null;
	                callback();
	            }
	        };
	    } else { // others
	        script.onload = function () {
	            callback();
	        };
	    }
	    script.src = url;
	    $('body').append(script);
	   // document.body.appendChild(script);
	},
	loading: function() {
		var classLoad = 'pwrd-loading';
		var create = function($wrapper) {
			if($('.'+classLoad, $wrapper).length == 0){
				$('<div/>', {
					'class': classLoad,
					text: ''
				}).appendTo($wrapper).hide();
			}
			//console.log(that);
			$('.'+classLoad, $wrapper).css({
				'width': $wrapper.outerWidth(),
				'height': $wrapper.outerHeight(),
				'top': 0,
				'left': 0
			}).fadeIn();
		};
		return {
			show: function($wrapper) {
				create($wrapper);
			},
			hide: function($wrapper) {
				if ($('.'+classLoad, $wrapper)) {
					$('.'+classLoad, $wrapper).fadeOut();
				}
			}
		}
	},
	refreshPage: function() {
		var re = /rand=\w+/;
		var strRand = 'rand=' + Math.random().toString(16).slice(2);
		var re_locationsearch = $('#re-locationsearch').val();
		if(re_locationsearch =='1'){
			location.search = '?'+strRand;
			return;
		}
		if(re.test(location.search)) {
			location.search = location.search.replace(re, strRand);
		} else if(/^\??$/.test(location.search)) {
			location.search = '?'+strRand;
		} else {
			location.search += '&'+strRand;
		}
	},
	refreshParamPage: function(pattern, flag, param) {
		//var re = /rand=\w+/;
		var re = new RegExp(pattern, flag); 
		if(re.test(location.search)) {
			location.search = location.search.replace(re, param);
		} else if(/^\??$/.test(location.search)) {
			location.search = '?'+ param;
		} else {
			location.search += '&'+ param;
		}
	},	
	resetUrlParam: function(arr, flag) {
		var url = (location.search).replace(/[ ]/g,"").replace(/(%20)/g, '')
		//console.log(url)
		for(var i=0, len=arr.length; i < len; i++) {
			var re = new RegExp(arr[i].reg, flag); 
			if(re.test(url)) {
				url = url.replace(re, arr[i].param);
			}
		}
		return url;
	},
	reFreshAjaxPage:function(res){
		var status = res.PWRDlit(':');
		$.FlashMessage(res);
		if(status[0] == 'success') {
			window.setTimeout(function(){
				location.href = location.href;
			}, 1500);
		}
	},
	dynamicFontSize: function(){
		// h1 home
		var newfontsize = Math.ceil((windowwidth/100)*(5));
		if (newfontsize < 30){
			newfontsize = 30;
		}
		var newlineheight = (newfontsize+5)+'px';
		$('.article_intro h1').css({'font-size':newfontsize, 'line-height':newlineheight});
		var article_intro_inner_h = $('.article_intro_inner').height();
		$('.article_intro_inner').css('margin-top', (article_intro_inner_h/2)*-1)
	},
	homeSize: function() {
		if (this.isDesktop()){
			$('.article_intro').height((this.getViewport('height')));
		}
	},

	isDesktop: function(){
		if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)){
			return false;
		} else {
			return true;
		}
	},
	getViewport: function(type) {
		var viewPortWidth;
		var viewPortHeight;
	
		// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
		if (typeof window.innerWidth != 'undefined') {
			viewPortWidth = window.innerWidth,
			viewPortHeight = window.innerHeight
		}
	
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
		else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
			viewPortWidth = document.documentElement.clientWidth,
			viewPortHeight = document.documentElement.clientHeight
		}
	
		// older versions of IE
		else {
			viewPortWidth = document.getElementsByTagName('body')[0].clientWidth,
			viewPortHeight = document.getElementsByTagName('body')[0].clientHeight
		}
		
		// return
		if (type == 'width'){
			return viewPortWidth;
		} else {
			return viewPortHeight;
		}
	},

	getBgPos: function(dpos, actbg, windowheight){
		var lastbg = actbg;
		$('.article').each(function(index){
			var element = $(this);
			var htmlpostop = dpos+windowheight;
			var elementpostop = Math.ceil(element.position().top);
			if (element.attr('data-bg') !== undefined && htmlpostop >= elementpostop){
				actbg = $('.article:eq('+index+')').attr('data-bg');
			}
		});
		if (actbg != lastbg){
			lastbg = actbg;
			if (dpos == 0){
				changeBg(0);
			} else {
				changeBg(actbg-1);
			}
		}
	},

	backgroundNoDesktop: function(){
		//$('.bg_item').remove();
		//$('.article_bg1').css('background', 'url(images/home/bg-home.jpg) no-repeat center center');
	},
	changeBg: function(showid){
		//$('.backstretch').css('marginTop', '0px');
		$('.backstretch').not($('.backstretch:eq('+showid+')')).css('visibility', 'hidden');
		$('.backstretch:eq('+showid+')').css('visibility', 'visible');
	},
	// add favorite
	AddFavorite: function(sURL, sTitle){
		try{
			window.external.addFavorite(sURL, sTitle);
		}
		catch (e){
			try{
				window.sidebar.addPanel(sTitle, sURL, "");
			}
			catch (e){
				alert("加入收藏失败，请使用Ctrl+D进行添加");
			}
		}
	},
	XHR:function(oData, Url, fn, method, callback){
		var that = this;
		if(XHR_GlOBAL){
			XHR_GlOBAL.abort();
		}
		XHR_GlOBAL = $.ajax({			
			type: method,
			url: Url,
			data: oData,
			async: true,
			statusCode: {
				404: function() {
					alert('page not found');
				}
			},
			dataType: "json",
			success: function(data){
				fn.call(that, data);
			}
		}).always(callback);
	},
	isObj: function(str){
		if(str==null||typeof(str)=='undefined')
		return false;
		return true;
	},
	isInt: function(str){
		var reg = /^(-|\+)?\d+$/ ;
		return reg.test(str);
	},
	isFloat: function(str){
		if(this.isInt(str))
		return true;
		var reg = /^(-|\+)?\d+\.\d*$/;
		return reg.test(str);
	},
	isIntOrNull: function(str){
		if(!this.isObj(str))//判断对象是否存在
		return 'undefined';
		return this.isNull(str)||this.isInt(str);
	},
	isNull: function(str){
		if(!this.isObj(str))
		return 'undefined';
		//alert("*"+str+"*");
		str=strTrim(str);
		//alert("*"+str+"*");
		if(str.length>0)
		return false;
		return true;
	},
// SetHome
	SetHome: function(obj,url){
		try{
			obj.style.behavior='url(#default#homepage)';obj.setHomePage(url);
		}
		catch(e){
			if(window.netscape) {
				try {
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
				}
				catch (e) {
					alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
				}
				var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
				prefs.setCharPref('browser.startup.homepage',url);
			 }
		}
	},
	//preload images
	preloadIimg : function(url, fn){
		var img = new Image();
		img.src = url;
		if (img.complete){
			fn.call(img);
		}
		else{
			img.onload = function(){
				fn.call(img);
				this.onload = null;
			}
		}
	},
	_picPreview: function() {
		if (!$('.pic-preview').length) {
			return;
		}
		
		$(document).tooltip({
			items: '.pic-preview',
			content: function() {
				if (!$(this).attr('href')) {
					return 'Image not found';
				}
				return '<img alt="loading..." src="' + $(this).attr('href') + '" />';
			}
		});
	},
	remoteFn: function(action, ele, oData){
		var that = this,
			oData_default = {                     //要传递的数据
				/*username: function() {
					return $(ele).val();
				},*/
				action : action
			};
			oData = $.extend({}, oData_default, oData );
		return {
			url: REQUESTS.ACTION, //后台处理程序
			type: "post",               //数据发送方式
			dataType: "json",           //接受数据格式  
			data: oData
		};
	}
};


/**
 * jQuery PWRD 
 */
(function($){
	$.LB = {
		config: {
			SC: '',
			FADE_TIME: 300
		},
		init: function(){
			this.bindEvents();
		},
		bindEvents: function(){			
			//set lightBox Scroll
			var that = this;
			$(window).bind('scroll resize', function(){
				that.lbSetScroll.call(that, null);
			});
			that.move();
		},
		
		// @returns window width	
		calculateScreenWidth: function(){	
			return $(window).width();	
		},		
		// @returns window height		
		calculateScreenHeight: function(){
			if(document.all){	
				var h = $('body').height();	
				if(h > $(window).height()){	
					return h + 20;
				}else{	
					return $(window).height();	
				}	
			}else{	
				var h = $('html').height();	
				if(h > $(window).height()){	
					return $('html').height();	
				}else{	
					return $(window).height();	
				}	
			}	
		},	
		// @returns the X position that will center an object		
		calculateCenterX: function(obj){
			return $(window).width()/2 - $(obj).width()/2;	
		},	
		// @returns the Y position that will center an object (adjusted to scroll top)		
		calculateCenterY: function(obj){
			return $(window).scrollTop() + ($(window).height()/2 - $(obj).height()/2);	
		},		
		//lightBox scroll
		lbSetScroll: function(){
			var that = this;
			if($('.dialogWrap').is(':visible')){
				clearTimeout(that.config.SC);
				that.config.SC = setTimeout(that.reposition, that.config.FADE_TIME);
			}
		},		
		//reposition
		reposition: function(){
			$('.dialogWrap:visible').each(function(){
				$(this).stop(true, true).animate({
					left: $.LB.calculateCenterX($(this))+'px',
					top: $.LB.calculateCenterY($(this))+'px'
				}, $.LB.config.FADE_TIME);
			});
		},
		move: function(){
			var _move=false,_x,_y,
				self = $('.dialogWrap:visible'),
				selfH = $('.dialogWrap:visible h3'),
				dialogW = self.width(),
				dialogH = self.height(),
				windowW = this.calculateScreenWidth(),
				windowH = $('body').height(),
				maxW = windowW- dialogW-2,
				maxH = windowH- dialogH-2;
			selfH.bind('mousedown', function(e){
				_move=true;
				_x = e.pageX - parseInt(self.css("left"));
				_y = e.pageY - parseInt(self.css("top"));
				self.css({opacity: 0.5});
			});				
			$(document).mousemove(function(e){
				if(_move){						
					var x = e.pageX-_x,
						y = e.pageY-_y;
					_currL = x > maxW ? maxW : (x < 0 ? 0 : x);
					_currT = y > maxH ? maxH : (y < 0 ? 0 : y);
					self.css({top: _currT, left: _currL});
					//console.log(_currL + ':' + _currT);
				}
			}).mouseup(function(){
				_move=false;
				self.css({opacity: 1});
		  });
		}
	};
	
})(jQuery);

//dialog

(function($){
$.PWRD = {
	myAlertBox: function(msg){
		// 提示用完
		$.PWRD.dialog.alert({
			id     : 'PWRD-dialog-alert',
			btnClose: false,
			title  : '',
			msg    : '<p class="txtMessage txtMessage01"><span>'+msg+'</span></p>',
			button : {
				text     : "确认",
				func : function(event){
					this.destroy();
				}
			}
		}).open();
	},
	alert: function(msg){
		this.dialog.alert({
			id     : 'PWRD-dialog-alert',
			title  : '提示',
			msg    : '<p class="txtMessage"><span>' + msg + '</span></p>',
			showbutton: false,
			button : {
				func : function(event){
					this.destroy();
				}
			}
		}).open();
	},
	alertBox: function(msg){
		this.dialog.alert({
			id     : 'PWRD-dialog-alert',
			title  : '提示',
			msg    : '<p class="txtMessage"><span>' + msg + '</span></p>',
			button : {
				func : function(event){
					this.destroy();
				}
			}
		}).open();
	},
	confirmBox: function(msg, fn){
		this.dialog.confirm({
			id      : 'PWRD-dialog-confirm',
			title   : '确认提交？',
			msg     : '<p class="txtMessage"><span>' + msg + '</span></p>',
			buttonY : {
				func : function(event){
					var self = this;
					this.destroy();					
					fn.apply(self, arguments);
				}
			},
			buttonN : {
				func : function(event){
					this.destroy();
				}
			}
		}).open();
	},
	dialog: {
		alert: function(setting){
			return this._alert._create(setting);
		},
		confirm: function(setting){
			return this._confirm._create(setting);
		},
		_alert: {
			options: {
				id        : "PWRD-dialog-alert",
				title     : "Alert",
				btnClose  : true,
				msg       : "",
				overlay   : true,
				showbutton: true,
				button    : {
					id       : "PWRD-dialog-btnClose",
					cssClass : "ui-btn ui-btn-inverse",

					text     : "关闭",
					data     : {},
					func     : function(){
						this.destroy();
					}
				}
			},
			_create: function(setting){
				var self = this,
					options = $.extend(true, {}, self.options, setting);
					
				if(self.PWRDDialog) self.destroy();
				
				var	id = options.id,
					title = options.title,
					msg = options.msg,
					btnClose = options.btnClose,
					showbutton = options.showbutton,
					PWRDDialogButtonPanel, 
					PWRDDialog = (self.PWRDDialog = $('<div></div>'))
						.appendTo(document.body)
						.hide()
						.addClass('dialogWrap')
						.attr('id', id);
					if($.trim(title) !== '') {
					var	PWRDDialogTitle = (self.PWRDDialogTitle = $('<h3></h3>'))
							.addClass('title')
							.text(title)
							.appendTo(PWRDDialog);
					}
					if(btnClose == true) {
					var PWRDDialogBtnClose = (self.PWRDDialogTitle = $('<span></span>'))
						.addClass('btnClose')
						.appendTo(PWRDDialog);
					}
						
					var PWRDDialogContent = (self.PWRDDialogContent = $('<div></div>'))
						.addClass('content')
						.appendTo(PWRDDialog),
					
					PWRDDialogMessage = (self.PWRDDialogMessage = $(msg))
						.appendTo(PWRDDialogContent);
					
				if(showbutton){
					PWRDDialogButtonPanel = (self.PWRDDialogButtonPanel = $('<div></div>'))
							.addClass('botButtonWrap')
							.appendTo(PWRDDialogContent);
					
					self._createButtons(options.button);
				}
				
				//if(options.overlay) $('#overlay01').click(function(){self.destroy();});
				
				return self;
			},
			_createButtons: function(button){
				var self = this;
				
				var PWRDDialogButton = $('<a href="javascript:;"></a>')
					.attr('id', button.id)
					.addClass(button.cssClass)
					.text(button.text)
					.bind('click', button.data, function(){button.func.apply(self, arguments);})
					.appendTo(self.PWRDDialogButtonPanel);
				
				return PWRDDialogButton;
			},
			destroy: function(){
				var self = this,
					options = self.options;				
				$('#overlay01').hide();
				self.PWRDDialog.remove();
			},
			open: function(){
				var self = this,
					options = self.options;					
				if(options.overlay) $('#overlay01').showOverlay();
				self.PWRDDialog.showPanelCenter();
				$.LB.init();
				return self;
			},
			close: function(){
				var self = this,
					options = self.options;
					
				$('#overlay01').hide();
				self.PWRDDialog.hide();
				
				return self;
			}
		},
		_confirm: {
			options: {
				id        : "PWRD-dialog-confirm",
				title     : "Confirm",
				msg       : "",
				overlay   : true,
				buttonY   : {
					id    : "PWRD-dialog-btnYes",
					cssClass : "ui-btn ",
					text  : "确认",
					data  : {},
					func  : function(){}
				},
				buttonN   : {
					id    : "PWRD-dialog-btnNo",
					cssClass : "ui-btn ui-btn-default",
					text  : "取消",
					data  : {},
					func  : function(){
						this.destroy();
					}
				}
			},
			_create: function(setting){
				var self = this,
					options = $.extend(true, {}, self.options, setting);
				
				if(self.PWRDDialog) self.destroy();
					
				var	id = options.id,
					title = options.title,
					msg = options.msg,
					
					PWRDDialog = (self.PWRDDialog = $('<div></div>'))
						.appendTo(document.body)
						.hide()
						.addClass('dialogWrap')
						.attr('id', id),
					
					PWRDDialogTitle = (self.PWRDDialogTitle = $('<h3></h3>'))
						.addClass('title')
						.text(title)
						.appendTo(PWRDDialog),
						
					PWRDDialogBtnClose = (self.PWRDDialogTitle = $('<span></span>'))
						.addClass('btnClose')
						.appendTo(PWRDDialog),
					
					PWRDDialogContent = (self.PWRDDialogContent = $('<div></div>'))
						.addClass('content')
						.appendTo(PWRDDialog),
						
					PWRDDialogMessage = (self.PWRDDialogMessage = $(msg))
						.appendTo(PWRDDialogContent),
						
					PWRDDialogButtonPanel = (self.PWRDDialogButtonPanel = $('<div></div>'))
						.addClass('botButtonWrap')
						.appendTo(PWRDDialogContent);
					
				self._createButtons(options.buttonY);
				self._createButtons(options.buttonN);
				
				//if(options.overlay) $('#overlay01').click(function(){self.destroy();});
				
				return self;
			},
			_createButtons: function(button){
				var self = this;
				
				var PWRDDialogButton = $('<a href="javascript:;"></a>')
					.attr('id', button.id)
					.addClass(button.cssClass)
					.text(button.text)
					.bind('click', button.data, function(){button.func.apply(self, arguments);})
					.appendTo(self.PWRDDialogButtonPanel);
				
				return 	PWRDDialogButton;
			},
			destroy: function(){
				var self = this,
					options = self.options;
				
				$('#overlay01').hide();
				self.PWRDDialog.remove();
			},
			open: function(){
				var self = this,
					options = self.options;					
				if(options.overlay) $('#overlay01').showOverlay();
				self.PWRDDialog.showPanelCenter();
				$.LB.init();
				return self;
			},
			close: function(){
				var self = this,
					options = self.options;
					
				$('#overlay01').hide();
				self.PWRDDialog.hide();
				
				return self;
			}
		}
	}
};

})(jQuery);

(function($){
	//show panels in center
	$.fn.showPanelCenter = function(){
		this.each(function(){
			var coorX = ($(window).width() - $(this).width())/2;
			var coorY = ($(window).height() - $(this).height())/2;
			coorX = $(window).scrollLeft() + ((coorX>0)?coorX:0);
			coorY = $(window).scrollTop() + ((coorY>0)?coorY:0);
			$(this).showPanelPosition(coorX, coorY);
		});
		
		return this;
	};
	
	//show panels in position
	$.fn.showPanelPosition = function(x, y){
		this.each(function(){
			$(this)
				.css({
					"left": x,
					"top": y
				})
				.show();
		});
		
		return this;
	};
	//preload images
	$.fn.getImage = function(url, fn){
		var that = this,
			self = $(this),
			selfParent = self.parent();
		that.each(function(i){
			var img = new Image(),
				_that = this;
			img.src = url;
			selfParent.hasClass('loadingPic') || selfParent.addClass('loadingPic');
			if (img.complete){
				selfParent.hasClass('loadingPic') && selfParent.removeClass('loadingPic');
				fn.call(_that, img);
			} else {
				selfParent.hasClass('loadingPic') && selfParent.removeClass('loadingPic');
				img.onload = function(){
					fn.call(_that, img);
				}
			}
		});		
		return this;
	};
		
	//preload images
	$.fn.preloadIimg = function(arrUrl, fn){
		this.each(function(i){
			if(!arrUrl[i]){
				arrUrl[i] = this.src;
			}
			var img = new Image();

			img.src = arrUrl[i];
			if (img.complete){
				fn.call(img);
			}
			else{
				img.onload = function(){
					fn.call(img);
					this.onload = null;
				}
			}
		});
		
		return this;
	};
	//textarea max character tips
	$.fn.maxCharTips = function(maxChar, jQ_objTips){
		this.each(function(i){
			$(this).keyup(function(){
				var str = $(this).val();
				var strLength = str.length;
				var charRemain = maxChar - strLength;
				var strTips = '剩余' + maxChar + '字';
				if(charRemain<0){
					$(this).val(str.substr(0, maxChar));
					
					strTips = '剩余0字符';
					jQ_objTips.eq(i).addClass("highlight");
					
					var scrollHeight = $(this)[0].scrollHeight;
					$(this).scrollTop(scrollHeight);
				} else{
					strTips = '剩余' + charRemain + '字';
					jQ_objTips.eq(i).removeClass("highlight");
				}
				jQ_objTips.eq(i).text(strTips);
			});			
		});
		
		return this;
	};
	
	//fadeout to remove an element
	$.fn.foRemove = function(during){
		during = during ? during : 600;
		this.each(function(){
			var obj = $(this);
			obj.animate({
				opacity: 0
			}, during, function(){
				obj.remove();
			});
		});
		
		return this;
	};
	
	
	//show loading side
	$.fn.showLoading = function(){
		this.each(function(){
			var selfW = $(this).width(),
				selfH = $(this).height(),
				coorX = selfW/2,
				coorY = selfH/2;							
			$('#loading01').css({'width': selfW, 'height': selfH});
			
			var loadingH = $('#loading01').height()/2,
				loadingW = $('#loading01').width()/2;
				
			coorX = $(this).offset().left + ((coorX>0)?coorX:0) - loadingW;
			coorY = $(this).offset().top + ((coorY>0)?coorY:0) - loadingH;
			$('#loading01').showPanelPosition(coorX, coorY);
		});
		
		return this;
	};
	
	//set default text in textbox
	$.fn.setDefaultText = function(strText){
		strText = strText ? strText : "";
		this.each(function(){
			var self = $(this);
			if(self.val() == ""){
				return true;
			}else{
				self.val(strText);
			}
			
			self.val(strText)
				.focus(function(){
					if(self.val() == strText) 
						$(this).val('');
				})
				.blur(function(){
					if(self.val() == "") 
						self.val(strText); 
				});
		});
		return this;
	};
	//show overlay
	$.fn.showOverlay = function(){
		this.each(function(){
			var self = $(this);
			self.height($.LB.calculateScreenHeight()).show();			
		});
		return this;
	};
	/*
	 * 关闭窗口
	 * close window	
	*/	

	$.fn.dropdown = function($obj){
		 this.each(function(){
			var that = $(this);
			that.on('mouseenter', $obj, function(){
				var self = $(this);
				self.find('.ui-dropdown-menu').stop(true, true).slideDown(100);
			}).on('mouseleave', $obj, function(){
				var self = $(this);
				self.find('.ui-dropdown-menu').stop(true, true).slideUp(100);
			});
		});
		return this;
	};
	$.fn.tabFn = function(){
		 this.each(function(){
			var that = $(this);
			that.on('mouseenter', '.tab-hd li', function(){
				var self = $(this),
					self_index = that.find('.tab-hd li').index(self);
				self.addClass('selected').siblings().removeClass('selected');
				that.find('.tab-bd .item:eq('+self_index+')').show().siblings().hide();
			});
		});
		return this;
	};
	
	$.fn.tabRecordFn = function(){
		 this.each(function(){
			var that = $(this);
			that.on('click', '.record-nav-list li', function(){
				var self = $(this),
					self_index = that.find('.record-nav-list li').index(self);
				self.addClass('record-selected').siblings().removeClass('record-selected');
				
				that.find('.record-tab-con:eq('+self_index+')').fadeIn(300).siblings().hide();
			});
		});
		return this;
	};
})(jQuery);


$(function(){
	$('body')
		.on('click',  '.dialogWrap .btnClose', function(){
			$(this).closest('.dialogWrap').hide();
			$('#overlay01').hide();
		})
		.on('click',  '.popform .cancelbtn', function(){
			$(this).closest('.popform').hide();
			$('#overlay01').hide();
		});

});